@(rowType: String, year:Int, month:Int, accountingRowForm: Form[AccountingRow])
@import utils.DateUtils
@import java.text.SimpleDateFormat
@import helper._
@import play.i18n._
@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrap.fieldConstructor.render) }
@main("Home") {

    @twitterBootstrap.alerts()

    <h1>@{DateUtils.month(month)} @{year} - @Messages.get("rowType." + rowType)</h1>

    @form(routes.Accounting.save(rowType, year, month),'class -> "form-horizontal") {

        @inputText(accountingRowForm("label"),
            '_label -> Messages.get("accountingRow.label")
        )

        @inputText(accountingRowForm("day"),
            '_label -> Messages.get("accountingRow.day"),
            '_help -> Messages.get("constraint.required"),
            'maxlength -> 2,
            'type -> "number",
            'min -> 1,
            'max -> 31
        )

        @inputText(accountingRowForm("amount"),
            '_label -> Messages.get("accountingRow.amount")
        )

        @*@select(accountingRowForm("rowType"),options(EAccountingRowType.values().toList.map(_.name())))*@
        @select(
            accountingRowForm("category.id"),
            options(Category.options(ERowType.valueOf(rowType.toUpperCase()))),
            '_label -> Messages.get("accountingRow.category"),
            '_default -> "",
            '_help -> Messages.get("constraint.required")
        )

        <div class="form-actions">
            <button type="button" class="btn">@Messages.get("action.cancel")</button>
            <button type="submit" class="btn btn-primary">@Messages.get("action.save")</button>
        </div>

    }
}
